1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.Window;
26 
27 private import gdk.Display;
28 private import gdk.MonitorGdk;
29 private import gio.ListModelIF;
30 private import glib.ConstructionException;
31 private import glib.ListG;
32 private import glib.Str;
33 private import glib.c.functions;
34 private import gobject.ObjectG;
35 private import gobject.Signals;
36 private import gtk.Application;
37 private import gtk.NativeIF;
38 private import gtk.NativeT;
39 private import gtk.RootIF;
40 private import gtk.RootT;
41 private import gtk.ShortcutManagerIF;
42 private import gtk.ShortcutManagerT;
43 private import gtk.Widget;
44 private import gtk.WindowGroup;
45 private import gtk.c.functions;
46 public  import gtk.c.types;
47 private import std.algorithm;
48 
49 
50 /**
51  * A `GtkWindow` is a toplevel window which can contain other widgets.
52  * 
53  * ![An example GtkWindow](window.png)
54  * 
55  * Windows normally have decorations that are under the control
56  * of the windowing system and allow the user to manipulate the window
57  * (resize it, move it, close it,...).
58  * 
59  * # GtkWindow as GtkBuildable
60  * 
61  * The `GtkWindow` implementation of the [iface@Gtk.Buildable] interface supports
62  * setting a child as the titlebar by specifying “titlebar” as the “type”
63  * attribute of a <child> element.
64  * 
65  * # CSS nodes
66  * 
67  * ```
68  * window.background [.csd / .solid-csd / .ssd] [.maximized / .fullscreen / .tiled]
69  * ├── <child>
70  * ╰── <titlebar child>.titlebar [.default-decoration]
71  * ```
72  * 
73  * `GtkWindow` has a main CSS node with name window and style class .background.
74  * 
75  * Style classes that are typically used with the main CSS node are .csd (when
76  * client-side decorations are in use), .solid-csd (for client-side decorations
77  * without invisible borders), .ssd (used by mutter when rendering server-side
78  * decorations). GtkWindow also represents window states with the following
79  * style classes on the main node: .maximized, .fullscreen, .tiled (when supported,
80  * also .tiled-top, .tiled-left, .tiled-right, .tiled-bottom).
81  * 
82  * `GtkWindow` subclasses often add their own discriminating style classes,
83  * such as .dialog, .popup or .tooltip.
84  * 
85  * Generally, some CSS properties don't make sense on the toplevel window node,
86  * such as margins or padding. When client-side decorations without invisible
87  * borders are in use (i.e. the .solid-csd style class is added to the
88  * main window node), the CSS border of the toplevel window is used for
89  * resize drags. In the .csd case, the shadow area outside of the window
90  * can be used to resize it.
91  * 
92  * `GtkWindow` adds the .titlebar and .default-decoration style classes to the
93  * widget that is added as a titlebar child.
94  * 
95  * # Accessibility
96  * 
97  * `GtkWindow` uses the %GTK_ACCESSIBLE_ROLE_WINDOW role.
98  * 
99  * # Actions
100  * 
101  * `GtkWindow` defines a set of built-in actions:
102  * - `default.activate`: Activate the default widget.
103  * - `window.minimize`: Minimize the window.
104  * - `window.toggle-maximized`: Maximize or restore the window.
105  * - `window.close`: Close the window.
106  */
107 public class Window : Widget, NativeIF, RootIF, ShortcutManagerIF
108 {
109 	/** the main Gtk struct */
110 	protected GtkWindow* gtkWindow;
111 
112 	/** Get the main Gtk struct */
113 	public GtkWindow* getWindowStruct(bool transferOwnership = false)
114 	{
115 		if (transferOwnership)
116 			ownedRef = false;
117 		return gtkWindow;
118 	}
119 
120 	/** the main Gtk struct as a void* */
121 	protected override void* getStruct()
122 	{
123 		return cast(void*)gtkWindow;
124 	}
125 
126 	/**
127 	 * Sets our main struct and passes it to the parent class.
128 	 */
129 	public this (GtkWindow* gtkWindow, bool ownedRef = false)
130 	{
131 		this.gtkWindow = gtkWindow;
132 		super(cast(GtkWidget*)gtkWindow, ownedRef);
133 	}
134 
135 	// add the Native capabilities
136 	mixin NativeT!(GtkWindow);
137 
138 	// add the Root capabilities
139 	mixin RootT!(GtkWindow);
140 
141 	// add the ShortcutManager capabilities
142 	mixin ShortcutManagerT!(GtkWindow);
143 
144 
145 	/** */
146 	public static GType getType()
147 	{
148 		return gtk_window_get_type();
149 	}
150 
151 	/**
152 	 * Creates a new `GtkWindow`.
153 	 *
154 	 * To get an undecorated window (no window borders), use
155 	 * [method@Gtk.Window.set_decorated].
156 	 *
157 	 * All top-level windows created by gtk_window_new() are stored
158 	 * in an internal top-level window list. This list can be obtained
159 	 * from [func@Gtk.Window.list_toplevels]. Due to GTK keeping a
160 	 * reference to the window internally, gtk_window_new() does not
161 	 * return a reference to the caller.
162 	 *
163 	 * To delete a `GtkWindow`, call [method@Gtk.Window.destroy].
164 	 *
165 	 * Returns: a new `GtkWindow`.
166 	 *
167 	 * Throws: ConstructionException GTK+ fails to create the object.
168 	 */
169 	public this()
170 	{
171 		auto __p = gtk_window_new();
172 
173 		if(__p is null)
174 		{
175 			throw new ConstructionException("null returned by new");
176 		}
177 
178 		this(cast(GtkWindow*) __p);
179 	}
180 
181 	/**
182 	 * Returns the fallback icon name for windows.
183 	 *
184 	 * The returned string is owned by GTK and should not
185 	 * be modified. It is only valid until the next call to
186 	 * [func@Gtk.Window.set_default_icon_name].
187 	 *
188 	 * Returns: the fallback icon name for windows
189 	 */
190 	public static string getDefaultIconName()
191 	{
192 		return Str.toString(gtk_window_get_default_icon_name());
193 	}
194 
195 	/**
196 	 * Returns a list of all existing toplevel windows.
197 	 *
198 	 * If you want to iterate through the list and perform actions involving
199 	 * callbacks that might destroy the widgets or add new ones, be aware that
200 	 * the list of toplevels will change and emit the "items-changed" signal.
201 	 *
202 	 * Returns: the list
203 	 *     of toplevel widgets
204 	 */
205 	public static ListModelIF getToplevels()
206 	{
207 		auto __p = gtk_window_get_toplevels();
208 
209 		if(__p is null)
210 		{
211 			return null;
212 		}
213 
214 		return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p);
215 	}
216 
217 	/**
218 	 * Returns a list of all existing toplevel windows.
219 	 *
220 	 * The widgets in the list are not individually referenced.
221 	 * If you want to iterate through the list and perform actions
222 	 * involving callbacks that might destroy the widgets, you must
223 	 * call `g_list_foreach (result, (GFunc)g_object_ref, NULL)` first,
224 	 * and then unref all the widgets afterwards.
225 	 *
226 	 * Returns: list of
227 	 *     toplevel widgets
228 	 */
229 	public static ListG listToplevels()
230 	{
231 		auto __p = gtk_window_list_toplevels();
232 
233 		if(__p is null)
234 		{
235 			return null;
236 		}
237 
238 		return new ListG(cast(GList*) __p);
239 	}
240 
241 	/**
242 	 * Sets whether the window should request startup notification.
243 	 *
244 	 * By default, after showing the first `GtkWindow`, GTK calls
245 	 * [method@Gdk.Display.notify_startup_complete]. Call this function
246 	 * to disable the automatic startup notification. You might do this
247 	 * if your first window is a splash screen, and you want to delay
248 	 * notification until after your real main window has been shown,
249 	 * for example.
250 	 *
251 	 * In that example, you would disable startup notification
252 	 * temporarily, show your splash screen, then re-enable it so that
253 	 * showing the main window would automatically result in notification.
254 	 *
255 	 * Params:
256 	 *     setting = %TRUE to automatically do startup notification
257 	 */
258 	public static void setAutoStartupNotification(bool setting)
259 	{
260 		gtk_window_set_auto_startup_notification(setting);
261 	}
262 
263 	/**
264 	 * Sets an icon to be used as fallback.
265 	 *
266 	 * The fallback icon is used for windows that
267 	 * haven't had [method@Gtk.Window.set_icon_name]
268 	 * called on them.
269 	 *
270 	 * Params:
271 	 *     name = the name of the themed icon
272 	 */
273 	public static void setDefaultIconName(string name)
274 	{
275 		gtk_window_set_default_icon_name(Str.toStringz(name));
276 	}
277 
278 	/**
279 	 * Opens or closes the [interactive debugger](running.html#interactive-debugging).
280 	 *
281 	 * The debugger offers access to the widget hierarchy of the application
282 	 * and to useful debugging tools.
283 	 *
284 	 * Params:
285 	 *     enable = %TRUE to enable interactive debugging
286 	 */
287 	public static void setInteractiveDebugging(bool enable)
288 	{
289 		gtk_window_set_interactive_debugging(enable);
290 	}
291 
292 	/**
293 	 * Requests that the window is closed.
294 	 *
295 	 * This is similar to what happens when a window manager
296 	 * close button is clicked.
297 	 *
298 	 * This function can be used with close buttons in custom
299 	 * titlebars.
300 	 */
301 	public void close()
302 	{
303 		gtk_window_close(gtkWindow);
304 	}
305 
306 	/**
307 	 * Drop the internal reference GTK holds on toplevel windows.
308 	 */
309 	public void destroy()
310 	{
311 		gtk_window_destroy(gtkWindow);
312 	}
313 
314 	/**
315 	 * Asks to place @window in the fullscreen state.
316 	 *
317 	 * Note that you shouldn’t assume the window is definitely fullscreen
318 	 * afterward, because other entities (e.g. the user or window manager
319 	 * unfullscreen it again, and not all window managers honor requests
320 	 * to fullscreen windows.
321 	 *
322 	 * You can track the result of this operation via the
323 	 * [property@Gdk.Toplevel:state] property, or by listening to
324 	 * notifications of the [property@Gtk.Window:fullscreened] property.
325 	 */
326 	public void fullscreen()
327 	{
328 		gtk_window_fullscreen(gtkWindow);
329 	}
330 
331 	/**
332 	 * Asks to place @window in the fullscreen state on the given @monitor.
333 	 *
334 	 * Note that you shouldn't assume the window is definitely fullscreen
335 	 * afterward, or that the windowing system allows fullscreen windows on
336 	 * any given monitor.
337 	 *
338 	 * You can track the result of this operation via the
339 	 * [property@Gdk.Toplevel:state] property, or by listening to
340 	 * notifications of the [property@Gtk.Window:fullscreened] property.
341 	 *
342 	 * Params:
343 	 *     monitor = which monitor to go fullscreen on
344 	 */
345 	public void fullscreenOnMonitor(MonitorGdk monitor)
346 	{
347 		gtk_window_fullscreen_on_monitor(gtkWindow, (monitor is null) ? null : monitor.getMonitorGdkStruct());
348 	}
349 
350 	/**
351 	 * Gets the `GtkApplication` associated with the window.
352 	 *
353 	 * Returns: a `GtkApplication`
354 	 */
355 	public Application getApplication()
356 	{
357 		auto __p = gtk_window_get_application(gtkWindow);
358 
359 		if(__p is null)
360 		{
361 			return null;
362 		}
363 
364 		return ObjectG.getDObject!(Application)(cast(GtkApplication*) __p);
365 	}
366 
367 	/**
368 	 * Gets the child widget of @window.
369 	 *
370 	 * Returns: the child widget of @window
371 	 */
372 	public Widget getChild()
373 	{
374 		auto __p = gtk_window_get_child(gtkWindow);
375 
376 		if(__p is null)
377 		{
378 			return null;
379 		}
380 
381 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
382 	}
383 
384 	/**
385 	 * Returns whether the window has been set to have decorations.
386 	 *
387 	 * Returns: %TRUE if the window has been set to have decorations
388 	 */
389 	public bool getDecorated()
390 	{
391 		return gtk_window_get_decorated(gtkWindow) != 0;
392 	}
393 
394 	/**
395 	 * Gets the default size of the window.
396 	 *
397 	 * A value of 0 for the width or height indicates that a default
398 	 * size has not been explicitly set for that dimension, so the
399 	 * “natural” size of the window will be used.
400 	 *
401 	 * Params:
402 	 *     width = location to store the default width
403 	 *     height = location to store the default height
404 	 */
405 	public void getDefaultSize(out int width, out int height)
406 	{
407 		gtk_window_get_default_size(gtkWindow, &width, &height);
408 	}
409 
410 	/**
411 	 * Returns the default widget for @window.
412 	 *
413 	 * Returns: the default widget
414 	 */
415 	public Widget getDefaultWidget()
416 	{
417 		auto __p = gtk_window_get_default_widget(gtkWindow);
418 
419 		if(__p is null)
420 		{
421 			return null;
422 		}
423 
424 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
425 	}
426 
427 	/**
428 	 * Returns whether the window has been set to have a close button.
429 	 *
430 	 * Returns: %TRUE if the window has been set to have a close button
431 	 */
432 	public bool getDeletable()
433 	{
434 		return gtk_window_get_deletable(gtkWindow) != 0;
435 	}
436 
437 	/**
438 	 * Returns whether the window will be destroyed with its transient parent.
439 	 *
440 	 * Returns: %TRUE if the window will be destroyed with its transient parent.
441 	 */
442 	public bool getDestroyWithParent()
443 	{
444 		return gtk_window_get_destroy_with_parent(gtkWindow) != 0;
445 	}
446 
447 	/**
448 	 * Retrieves the current focused widget within the window.
449 	 *
450 	 * Note that this is the widget that would have the focus
451 	 * if the toplevel window focused; if the toplevel window
452 	 * is not focused then `gtk_widget_has_focus (widget)` will
453 	 * not be %TRUE for the widget.
454 	 *
455 	 * Returns: the currently focused widget
456 	 */
457 	public Widget getFocus()
458 	{
459 		auto __p = gtk_window_get_focus(gtkWindow);
460 
461 		if(__p is null)
462 		{
463 			return null;
464 		}
465 
466 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
467 	}
468 
469 	/**
470 	 * Gets whether “focus rectangles” are supposed to be visible.
471 	 *
472 	 * Returns: %TRUE if “focus rectangles” are supposed to be visible
473 	 *     in this window.
474 	 */
475 	public bool getFocusVisible()
476 	{
477 		return gtk_window_get_focus_visible(gtkWindow) != 0;
478 	}
479 
480 	/**
481 	 * Returns the group for @window.
482 	 *
483 	 * If the window has no group, then the default group is returned.
484 	 *
485 	 * Returns: the `GtkWindowGroup` for a window
486 	 *     or the default group
487 	 */
488 	public WindowGroup getGroup()
489 	{
490 		auto __p = gtk_window_get_group(gtkWindow);
491 
492 		if(__p is null)
493 		{
494 			return null;
495 		}
496 
497 		return ObjectG.getDObject!(WindowGroup)(cast(GtkWindowGroup*) __p);
498 	}
499 
500 	/**
501 	 * Returns whether this window reacts to F10 key presses by
502 	 * activating a menubar it contains.
503 	 *
504 	 * Returns: %TRUE if the window handles F10
505 	 *
506 	 * Since: 4.2
507 	 */
508 	public bool getHandleMenubarAccel()
509 	{
510 		return gtk_window_get_handle_menubar_accel(gtkWindow) != 0;
511 	}
512 
513 	/**
514 	 * Returns whether the window will be hidden when the close button is clicked.
515 	 *
516 	 * Returns: %TRUE if the window will be hidden
517 	 */
518 	public bool getHideOnClose()
519 	{
520 		return gtk_window_get_hide_on_close(gtkWindow) != 0;
521 	}
522 
523 	/**
524 	 * Returns the name of the themed icon for the window.
525 	 *
526 	 * Returns: the icon name
527 	 */
528 	public string getIconName()
529 	{
530 		return Str.toString(gtk_window_get_icon_name(gtkWindow));
531 	}
532 
533 	/**
534 	 * Gets whether mnemonics are supposed to be visible.
535 	 *
536 	 * Returns: %TRUE if mnemonics are supposed to be visible
537 	 *     in this window.
538 	 */
539 	public bool getMnemonicsVisible()
540 	{
541 		return gtk_window_get_mnemonics_visible(gtkWindow) != 0;
542 	}
543 
544 	/**
545 	 * Returns whether the window is modal.
546 	 *
547 	 * Returns: %TRUE if the window is set to be modal and
548 	 *     establishes a grab when shown
549 	 */
550 	public bool getModal()
551 	{
552 		return gtk_window_get_modal(gtkWindow) != 0;
553 	}
554 
555 	/**
556 	 * Gets the value set by gtk_window_set_resizable().
557 	 *
558 	 * Returns: %TRUE if the user can resize the window
559 	 */
560 	public bool getResizable()
561 	{
562 		return gtk_window_get_resizable(gtkWindow) != 0;
563 	}
564 
565 	/**
566 	 * Retrieves the title of the window.
567 	 *
568 	 * Returns: the title of the window
569 	 */
570 	public string getTitle()
571 	{
572 		return Str.toString(gtk_window_get_title(gtkWindow));
573 	}
574 
575 	/**
576 	 * Returns the custom titlebar that has been set with
577 	 * gtk_window_set_titlebar().
578 	 *
579 	 * Returns: the custom titlebar
580 	 */
581 	public Widget getTitlebar()
582 	{
583 		auto __p = gtk_window_get_titlebar(gtkWindow);
584 
585 		if(__p is null)
586 		{
587 			return null;
588 		}
589 
590 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
591 	}
592 
593 	/**
594 	 * Fetches the transient parent for this window.
595 	 *
596 	 * Returns: the transient parent for this window
597 	 */
598 	public Window getTransientFor()
599 	{
600 		auto __p = gtk_window_get_transient_for(gtkWindow);
601 
602 		if(__p is null)
603 		{
604 			return null;
605 		}
606 
607 		return ObjectG.getDObject!(Window)(cast(GtkWindow*) __p);
608 	}
609 
610 	/**
611 	 * Returns whether @window has an explicit window group.
612 	 *
613 	 * Returns: %TRUE if @window has an explicit window group.
614 	 */
615 	public bool hasGroup()
616 	{
617 		return gtk_window_has_group(gtkWindow) != 0;
618 	}
619 
620 	/**
621 	 * Returns whether the window is part of the current active toplevel.
622 	 *
623 	 * The active toplevel is the window receiving keystrokes.
624 	 *
625 	 * The return value is %TRUE if the window is active toplevel itself.
626 	 * You might use this function if you wanted to draw a widget
627 	 * differently in an active window from a widget in an inactive window.
628 	 *
629 	 * Returns: %TRUE if the window part of the current active window.
630 	 */
631 	public bool isActive()
632 	{
633 		return gtk_window_is_active(gtkWindow) != 0;
634 	}
635 
636 	/**
637 	 * Retrieves the current fullscreen state of @window.
638 	 *
639 	 * Note that since fullscreening is ultimately handled by the window
640 	 * manager and happens asynchronously to an application request, you
641 	 * shouldn’t assume the return value of this function changing
642 	 * immediately (or at all), as an effect of calling
643 	 * [method@Gtk.Window.fullscreen] or [method@Gtk.Window.unfullscreen].
644 	 *
645 	 * If the window isn't yet mapped, the value returned will whether the
646 	 * initial requested state is fullscreen.
647 	 *
648 	 * Returns: whether the window has a fullscreen state.
649 	 */
650 	public bool isFullscreen()
651 	{
652 		return gtk_window_is_fullscreen(gtkWindow) != 0;
653 	}
654 
655 	/**
656 	 * Retrieves the current maximized state of @window.
657 	 *
658 	 * Note that since maximization is ultimately handled by the window
659 	 * manager and happens asynchronously to an application request, you
660 	 * shouldn’t assume the return value of this function changing
661 	 * immediately (or at all), as an effect of calling
662 	 * [method@Gtk.Window.maximize] or [method@Gtk.Window.unmaximize].
663 	 *
664 	 * If the window isn't yet mapped, the value returned will whether the
665 	 * initial requested state is maximized.
666 	 *
667 	 * Returns: whether the window has a maximized state.
668 	 */
669 	public bool isMaximized()
670 	{
671 		return gtk_window_is_maximized(gtkWindow) != 0;
672 	}
673 
674 	/**
675 	 * Asks to maximize @window, so that it fills the screen.
676 	 *
677 	 * Note that you shouldn’t assume the window is definitely maximized
678 	 * afterward, because other entities (e.g. the user or window manager
679 	 * could unmaximize it again, and not all window managers support
680 	 * maximization.
681 	 *
682 	 * It’s permitted to call this function before showing a window,
683 	 * in which case the window will be maximized when it appears onscreen
684 	 * initially.
685 	 *
686 	 * You can track the result of this operation via the
687 	 * [property@Gdk.Toplevel:state] property, or by listening to
688 	 * notifications on the [property@Gtk.Window:maximized]
689 	 * property.
690 	 */
691 	public void maximize()
692 	{
693 		gtk_window_maximize(gtkWindow);
694 	}
695 
696 	/**
697 	 * Asks to minimize the specified @window.
698 	 *
699 	 * Note that you shouldn’t assume the window is definitely minimized
700 	 * afterward, because the windowing system might not support this
701 	 * functionality; other entities (e.g. the user or the window manager
702 	 * could unminimize it again, or there may not be a window manager in
703 	 * which case minimization isn’t possible, etc.
704 	 *
705 	 * It’s permitted to call this function before showing a window,
706 	 * in which case the window will be minimized before it ever appears
707 	 * onscreen.
708 	 *
709 	 * You can track result of this operation via the
710 	 * [property@Gdk.Toplevel:state] property.
711 	 */
712 	public void minimize()
713 	{
714 		gtk_window_minimize(gtkWindow);
715 	}
716 
717 	/**
718 	 * Presents a window to the user.
719 	 *
720 	 * This function should not be used as when it is called,
721 	 * it is too late to gather a valid timestamp to allow focus
722 	 * stealing prevention to work correctly.
723 	 */
724 	public void present()
725 	{
726 		gtk_window_present(gtkWindow);
727 	}
728 
729 	/**
730 	 * Presents a window to the user.
731 	 *
732 	 * This may mean raising the window in the stacking order,
733 	 * unminimizing it, moving it to the current desktop, and/or
734 	 * giving it the keyboard focus, possibly dependent on the user’s
735 	 * platform, window manager, and preferences.
736 	 *
737 	 * If @window is hidden, this function calls [method@Gtk.Widget.show]
738 	 * as well.
739 	 *
740 	 * This function should be used when the user tries to open a window
741 	 * that’s already open. Say for example the preferences dialog is
742 	 * currently open, and the user chooses Preferences from the menu
743 	 * a second time; use [method@Gtk.Window.present] to move the
744 	 * already-open dialog where the user can see it.
745 	 *
746 	 * Presents a window to the user in response to a user interaction.
747 	 * The timestamp should be gathered when the window was requested
748 	 * to be shown (when clicking a link for example), rather than once
749 	 * the window is ready to be shown.
750 	 *
751 	 * Params:
752 	 *     timestamp = the timestamp of the user interaction (typically a
753 	 *         button or key press event) which triggered this call
754 	 */
755 	public void presentWithTime(uint timestamp)
756 	{
757 		gtk_window_present_with_time(gtkWindow, timestamp);
758 	}
759 
760 	/**
761 	 * Sets or unsets the `GtkApplication` associated with the window.
762 	 *
763 	 * The application will be kept alive for at least as long as it has
764 	 * any windows associated with it (see g_application_hold() for a way
765 	 * to keep it alive without windows).
766 	 *
767 	 * Normally, the connection between the application and the window will
768 	 * remain until the window is destroyed, but you can explicitly remove
769 	 * it by setting the @application to %NULL.
770 	 *
771 	 * This is equivalent to calling [method@Gtk.Application.remove_window]
772 	 * and/or [method@Gtk.Application.add_window] on the old/new applications
773 	 * as relevant.
774 	 *
775 	 * Params:
776 	 *     application = a `GtkApplication`, or %NULL to unset
777 	 */
778 	public void setApplication(Application application)
779 	{
780 		gtk_window_set_application(gtkWindow, (application is null) ? null : application.getGtkApplicationStruct());
781 	}
782 
783 	/**
784 	 * Sets the child widget of @window.
785 	 *
786 	 * Params:
787 	 *     child = the child widget
788 	 */
789 	public void setChild(Widget child)
790 	{
791 		gtk_window_set_child(gtkWindow, (child is null) ? null : child.getWidgetStruct());
792 	}
793 
794 	/**
795 	 * Sets whether the window should be decorated.
796 	 *
797 	 * By default, windows are decorated with a title bar, resize
798 	 * controls, etc. Some window managers allow GTK to disable these
799 	 * decorations, creating a borderless window. If you set the decorated
800 	 * property to %FALSE using this function, GTK will do its best to
801 	 * convince the window manager not to decorate the window. Depending on
802 	 * the system, this function may not have any effect when called on a
803 	 * window that is already visible, so you should call it before calling
804 	 * [method@Gtk.Widget.show].
805 	 *
806 	 * On Windows, this function always works, since there’s no window manager
807 	 * policy involved.
808 	 *
809 	 * Params:
810 	 *     setting = %TRUE to decorate the window
811 	 */
812 	public void setDecorated(bool setting)
813 	{
814 		gtk_window_set_decorated(gtkWindow, setting);
815 	}
816 
817 	/**
818 	 * Sets the default size of a window.
819 	 *
820 	 * If the window’s “natural” size (its size request) is larger than
821 	 * the default, the default will be ignored.
822 	 *
823 	 * Unlike [method@Gtk.Widget.set_size_request], which sets a size
824 	 * request for a widget and thus would keep users from shrinking
825 	 * the window, this function only sets the initial size, just as
826 	 * if the user had resized the window themselves. Users can still
827 	 * shrink the window again as they normally would. Setting a default
828 	 * size of -1 means to use the “natural” default size (the size request
829 	 * of the window).
830 	 *
831 	 * The default size of a window only affects the first time a window is
832 	 * shown; if a window is hidden and re-shown, it will remember the size
833 	 * it had prior to hiding, rather than using the default size.
834 	 *
835 	 * Windows can’t actually be 0x0 in size, they must be at least 1x1, but
836 	 * passing 0 for @width and @height is OK, resulting in a 1x1 default size.
837 	 *
838 	 * If you use this function to reestablish a previously saved window size,
839 	 * note that the appropriate size to save is the one returned by
840 	 * [method@Gtk.Window.get_default_size]. Using the window allocation
841 	 * directly will not work in all circumstances and can lead to growing
842 	 * or shrinking windows.
843 	 *
844 	 * Params:
845 	 *     width = width in pixels, or -1 to unset the default width
846 	 *     height = height in pixels, or -1 to unset the default height
847 	 */
848 	public void setDefaultSize(int width, int height)
849 	{
850 		gtk_window_set_default_size(gtkWindow, width, height);
851 	}
852 
853 	/**
854 	 * Sets the default widget.
855 	 *
856 	 * The default widget is the widget that is activated when the user
857 	 * presses Enter in a dialog (for example).
858 	 *
859 	 * Params:
860 	 *     defaultWidget = widget to be the default
861 	 *         to unset the default widget for the toplevel
862 	 */
863 	public void setDefaultWidget(Widget defaultWidget)
864 	{
865 		gtk_window_set_default_widget(gtkWindow, (defaultWidget is null) ? null : defaultWidget.getWidgetStruct());
866 	}
867 
868 	/**
869 	 * Sets whether the window should be deletable.
870 	 *
871 	 * By default, windows have a close button in the window frame.
872 	 * Some  window managers allow GTK to disable this button. If you
873 	 * set the deletable property to %FALSE using this function, GTK
874 	 * will do its best to convince the window manager not to show a
875 	 * close button. Depending on the system, this function may not
876 	 * have any effect when called on a window that is already visible,
877 	 * so you should call it before calling [method@Gtk.Widget.show].
878 	 *
879 	 * On Windows, this function always works, since there’s no window
880 	 * manager policy involved.
881 	 *
882 	 * Params:
883 	 *     setting = %TRUE to decorate the window as deletable
884 	 */
885 	public void setDeletable(bool setting)
886 	{
887 		gtk_window_set_deletable(gtkWindow, setting);
888 	}
889 
890 	/**
891 	 * If @setting is %TRUE, then destroying the transient parent of @window
892 	 * will also destroy @window itself.
893 	 *
894 	 * This is useful for dialogs that shouldn’t persist beyond the lifetime
895 	 * of the main window they are associated with, for example.
896 	 *
897 	 * Params:
898 	 *     setting = whether to destroy @window with its transient parent
899 	 */
900 	public void setDestroyWithParent(bool setting)
901 	{
902 		gtk_window_set_destroy_with_parent(gtkWindow, setting);
903 	}
904 
905 	/**
906 	 * Sets the `GdkDisplay` where the @window is displayed.
907 	 *
908 	 * If the window is already mapped, it will be unmapped,
909 	 * and then remapped on the new display.
910 	 *
911 	 * Params:
912 	 *     display = a `GdkDisplay`
913 	 */
914 	public void setDisplay(Display display)
915 	{
916 		gtk_window_set_display(gtkWindow, (display is null) ? null : display.getDisplayStruct());
917 	}
918 
919 	/**
920 	 * Sets the focus widget.
921 	 *
922 	 * If @focus is not the current focus widget, and is focusable,
923 	 * sets it as the focus widget for the window. If @focus is %NULL,
924 	 * unsets the focus widget for this window. To set the focus to a
925 	 * particular widget in the toplevel, it is usually more convenient
926 	 * to use [method@Gtk.Widget.grab_focus] instead of this function.
927 	 *
928 	 * Params:
929 	 *     focus = widget to be the new focus widget, or %NULL to unset
930 	 *         any focus widget for the toplevel window.
931 	 */
932 	public void setFocus(Widget focus)
933 	{
934 		gtk_window_set_focus(gtkWindow, (focus is null) ? null : focus.getWidgetStruct());
935 	}
936 
937 	/**
938 	 * Sets whether “focus rectangles” are supposed to be visible.
939 	 *
940 	 * Params:
941 	 *     setting = the new value
942 	 */
943 	public void setFocusVisible(bool setting)
944 	{
945 		gtk_window_set_focus_visible(gtkWindow, setting);
946 	}
947 
948 	/**
949 	 * Sets whether this window should react to F10 key presses
950 	 * by activating a menubar it contains.
951 	 *
952 	 * Params:
953 	 *     handleMenubarAccel = %TRUE to make @window handle F10
954 	 *
955 	 * Since: 4.2
956 	 */
957 	public void setHandleMenubarAccel(bool handleMenubarAccel)
958 	{
959 		gtk_window_set_handle_menubar_accel(gtkWindow, handleMenubarAccel);
960 	}
961 
962 	/**
963 	 * If @setting is %TRUE, then clicking the close button on the window
964 	 * will not destroy it, but only hide it.
965 	 *
966 	 * Params:
967 	 *     setting = whether to hide the window when it is closed
968 	 */
969 	public void setHideOnClose(bool setting)
970 	{
971 		gtk_window_set_hide_on_close(gtkWindow, setting);
972 	}
973 
974 	/**
975 	 * Sets the icon for the window from a named themed icon.
976 	 *
977 	 * See the docs for [class@Gtk.IconTheme] for more details.
978 	 * On some platforms, the window icon is not used at all.
979 	 *
980 	 * Note that this has nothing to do with the WM_ICON_NAME
981 	 * property which is mentioned in the ICCCM.
982 	 *
983 	 * Params:
984 	 *     name = the name of the themed icon
985 	 */
986 	public void setIconName(string name)
987 	{
988 		gtk_window_set_icon_name(gtkWindow, Str.toStringz(name));
989 	}
990 
991 	/**
992 	 * Sets whether mnemonics are supposed to be visible.
993 	 *
994 	 * Params:
995 	 *     setting = the new value
996 	 */
997 	public void setMnemonicsVisible(bool setting)
998 	{
999 		gtk_window_set_mnemonics_visible(gtkWindow, setting);
1000 	}
1001 
1002 	/**
1003 	 * Sets a window modal or non-modal.
1004 	 *
1005 	 * Modal windows prevent interaction with other windows in the same
1006 	 * application. To keep modal dialogs on top of main application windows,
1007 	 * use [method@Gtk.Window.set_transient_for] to make the dialog transient
1008 	 * for the parent; most window managers will then disallow lowering the
1009 	 * dialog below the parent.
1010 	 *
1011 	 * Params:
1012 	 *     modal = whether the window is modal
1013 	 */
1014 	public void setModal(bool modal)
1015 	{
1016 		gtk_window_set_modal(gtkWindow, modal);
1017 	}
1018 
1019 	/**
1020 	 * Sets whether the user can resize a window.
1021 	 *
1022 	 * Windows are user resizable by default.
1023 	 *
1024 	 * Params:
1025 	 *     resizable = %TRUE if the user can resize this window
1026 	 */
1027 	public void setResizable(bool resizable)
1028 	{
1029 		gtk_window_set_resizable(gtkWindow, resizable);
1030 	}
1031 
1032 	/**
1033 	 * Sets the startup notification ID.
1034 	 *
1035 	 * Startup notification identifiers are used by desktop environment
1036 	 * to track application startup, to provide user feedback and other
1037 	 * features. This function changes the corresponding property on the
1038 	 * underlying `GdkSurface`.
1039 	 *
1040 	 * Normally, startup identifier is managed automatically and you should
1041 	 * only use this function in special cases like transferring focus from
1042 	 * other processes. You should use this function before calling
1043 	 * [method@Gtk.Window.present] or any equivalent function generating
1044 	 * a window map event.
1045 	 *
1046 	 * This function is only useful on X11, not with other GTK targets.
1047 	 *
1048 	 * Params:
1049 	 *     startupId = a string with startup-notification identifier
1050 	 */
1051 	public void setStartupId(string startupId)
1052 	{
1053 		gtk_window_set_startup_id(gtkWindow, Str.toStringz(startupId));
1054 	}
1055 
1056 	/**
1057 	 * Sets the title of the `GtkWindow`.
1058 	 *
1059 	 * The title of a window will be displayed in its title bar; on the
1060 	 * X Window System, the title bar is rendered by the window manager
1061 	 * so exactly how the title appears to users may vary according to a
1062 	 * user’s exact configuration. The title should help a user distinguish
1063 	 * this window from other windows they may have open. A good title might
1064 	 * include the application name and current document filename, for example.
1065 	 *
1066 	 * Passing %NULL does the same as setting the title to an empty string.
1067 	 *
1068 	 * Params:
1069 	 *     title = title of the window
1070 	 */
1071 	public void setTitle(string title)
1072 	{
1073 		gtk_window_set_title(gtkWindow, Str.toStringz(title));
1074 	}
1075 
1076 	/**
1077 	 * Sets a custom titlebar for @window.
1078 	 *
1079 	 * A typical widget used here is [class@Gtk.HeaderBar], as it
1080 	 * provides various features expected of a titlebar while allowing
1081 	 * the addition of child widgets to it.
1082 	 *
1083 	 * If you set a custom titlebar, GTK will do its best to convince
1084 	 * the window manager not to put its own titlebar on the window.
1085 	 * Depending on the system, this function may not work for a window
1086 	 * that is already visible, so you set the titlebar before calling
1087 	 * [method@Gtk.Widget.show].
1088 	 *
1089 	 * Params:
1090 	 *     titlebar = the widget to use as titlebar
1091 	 */
1092 	public void setTitlebar(Widget titlebar)
1093 	{
1094 		gtk_window_set_titlebar(gtkWindow, (titlebar is null) ? null : titlebar.getWidgetStruct());
1095 	}
1096 
1097 	/**
1098 	 * Dialog windows should be set transient for the main application
1099 	 * window they were spawned from. This allows window managers to e.g.
1100 	 * keep the dialog on top of the main window, or center the dialog
1101 	 * over the main window. [ctor@Gtk.Dialog.new_with_buttons] and other
1102 	 * convenience functions in GTK will sometimes call
1103 	 * gtk_window_set_transient_for() on your behalf.
1104 	 *
1105 	 * Passing %NULL for @parent unsets the current transient window.
1106 	 *
1107 	 * On Windows, this function puts the child window on top of the parent,
1108 	 * much as the window manager would have done on X.
1109 	 *
1110 	 * Params:
1111 	 *     parent = parent window
1112 	 */
1113 	public void setTransientFor(Window parent)
1114 	{
1115 		gtk_window_set_transient_for(gtkWindow, (parent is null) ? null : parent.getWindowStruct());
1116 	}
1117 
1118 	/**
1119 	 * Asks to remove the fullscreen state for @window, and return to
1120 	 * its previous state.
1121 	 *
1122 	 * Note that you shouldn’t assume the window is definitely not
1123 	 * fullscreen afterward, because other entities (e.g. the user or
1124 	 * window manager could fullscreen it again, and not all window
1125 	 * managers honor requests to unfullscreen windows; normally the
1126 	 * window will end up restored to its normal state. Just don’t
1127 	 * write code that crashes if not.
1128 	 *
1129 	 * You can track the result of this operation via the
1130 	 * [property@Gdk.Toplevel:state] property, or by listening to
1131 	 * notifications of the [property@Gtk.Window:fullscreened] property.
1132 	 */
1133 	public void unfullscreen()
1134 	{
1135 		gtk_window_unfullscreen(gtkWindow);
1136 	}
1137 
1138 	/**
1139 	 * Asks to unmaximize @window.
1140 	 *
1141 	 * Note that you shouldn’t assume the window is definitely unmaximized
1142 	 * afterward, because other entities (e.g. the user or window manager
1143 	 * maximize it again, and not all window managers honor requests to
1144 	 * unmaximize.
1145 	 *
1146 	 * You can track the result of this operation via the
1147 	 * [property@Gdk.Toplevel:state] property, or by listening to
1148 	 * notifications on the [property@Gtk.Window:maximized] property.
1149 	 */
1150 	public void unmaximize()
1151 	{
1152 		gtk_window_unmaximize(gtkWindow);
1153 	}
1154 
1155 	/**
1156 	 * Asks to unminimize the specified @window.
1157 	 *
1158 	 * Note that you shouldn’t assume the window is definitely unminimized
1159 	 * afterward, because the windowing system might not support this
1160 	 * functionality; other entities (e.g. the user or the window manager
1161 	 * could minimize it again, or there may not be a window manager in
1162 	 * which case minimization isn’t possible, etc.
1163 	 *
1164 	 * You can track result of this operation via the
1165 	 * [property@Gdk.Toplevel:state] property.
1166 	 */
1167 	public void unminimize()
1168 	{
1169 		gtk_window_unminimize(gtkWindow);
1170 	}
1171 
1172 	/**
1173 	 * Emitted when the user activates the default widget
1174 	 * of @window.
1175 	 *
1176 	 * This is a [keybinding signal](class.SignalAction.html).
1177 	 */
1178 	gulong addOnActivateDefault(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1179 	{
1180 		return Signals.connect(this, "activate-default", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1181 	}
1182 
1183 	/**
1184 	 * Emitted when the user activates the currently focused
1185 	 * widget of @window.
1186 	 *
1187 	 * This is a [keybinding signal](class.SignalAction.html).
1188 	 */
1189 	gulong addOnActivateFocus(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1190 	{
1191 		return Signals.connect(this, "activate-focus", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1192 	}
1193 
1194 	/**
1195 	 * Emitted when the user clicks on the close button of the window.
1196 	 *
1197 	 * Returns: %TRUE to stop other handlers from being invoked for the signal
1198 	 */
1199 	gulong addOnCloseRequest(bool delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1200 	{
1201 		return Signals.connect(this, "close-request", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1202 	}
1203 
1204 	/**
1205 	 * Emitted when the user enables or disables interactive debugging.
1206 	 *
1207 	 * When @toggle is %TRUE, interactive debugging is toggled on or off,
1208 	 * when it is %FALSE, the debugger will be pointed at the widget
1209 	 * under the pointer.
1210 	 *
1211 	 * This is a [keybinding signal](class.SignalAction.html).
1212 	 *
1213 	 * The default bindings for this signal are Ctrl-Shift-I
1214 	 * and Ctrl-Shift-D.
1215 	 *
1216 	 * Params:
1217 	 *     toggle = toggle the debugger
1218 	 *
1219 	 * Returns: %TRUE if the key binding was handled
1220 	 */
1221 	gulong addOnEnableDebugging(bool delegate(bool, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1222 	{
1223 		return Signals.connect(this, "enable-debugging", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1224 	}
1225 
1226 	/**
1227 	 * emitted when the set of accelerators or mnemonics that
1228 	 * are associated with @window changes.
1229 	 */
1230 	gulong addOnKeysChanged(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1231 	{
1232 		return Signals.connect(this, "keys-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1233 	}
1234 }